package com.example.apptest;

import android.Manifest;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;

import com.example.app_test.R;
import com.example.apptest.utils.PermissionHelper;
import com.example.apptest.utils.SQLHelper;
import com.example.apptest.view.BarView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.viewpager2.widget.ViewPager2;

public class MainActivity extends AppCompatActivity {


    private final String[] Permissions = new String[] {
            Manifest.permission.BLUETOOTH,
            Manifest.permission.BLUETOOTH_ADMIN,
            Manifest.permission.BLUETOOTH_CONNECT,
            Manifest.permission.BLUETOOTH_SCAN,
            Manifest.permission.ACCESS_FINE_LOCATION,
            Manifest.permission.ACCESS_COARSE_LOCATION,
    };
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment);
        ViewPager2 viewPager = findViewById(R.id.view_page);
        BarView barView = findViewById(R.id.bar);
        FragmentAdapter adapter = new FragmentAdapter(this);
        viewPager.setAdapter(adapter);
        barView.setViewPager(viewPager);

        // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
        ActivityCompat.requestPermissions(this, Permissions, 123);
        //}
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 123) {


        }
    }

    @Override
    protected void onStop() {
        super.onStop();
        SQLHelper.getInstance().close();
    }


}
